package com.qqtech.qquan.circle.model;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.qqtech.core.common.enums.YesNoEnum;
import com.qqtech.core.common.util.StringUtil;
import com.qqtech.qquan.circle.enums.CircleMemberTypeDictEnum;
import com.qqtech.qquan.user.enums.UserConst;

@SuppressWarnings("serial")
public class CircleMemberVo extends CircleMember{
	
	/**圈友名称**/
	private java.lang.String memberName;
	/**圈友头象**/
	private java.lang.String memberImg;
	
	/**圈友消息**/
	private java.lang.String memberMsg;
	
	/**圈友消息-时间**/
	private java.lang.String memberMsgTimeCn;
	
	/**所在圈子名称**/
	private java.lang.String circleName;
	
	/**头衔名称**/
	private java.lang.String gradeName;
	
	/** 性别：1-男 2-女 */
	private java.lang.Integer sex;
	
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this,
				ToStringStyle.MULTI_LINE_STYLE);
	}

	public java.lang.String getMemberName() {
		if(StringUtil.isBlank(memberName)){
			return "新手";
		}
		return memberName;
	}

	public void setMemberName(java.lang.String memberName) {
		this.memberName = memberName;
	}

	public java.lang.String getMemberImg() {
		return memberImg;
	}

	public void setMemberImg(java.lang.String memberImg) {
		this.memberImg = memberImg;
	}

	public java.lang.String getMemberMsg() {
		return memberMsg;
	}

	public void setMemberMsg(java.lang.String memberMsg) {
		this.memberMsg = memberMsg;
	}

	public java.lang.String getMemberMsgTimeCn() {
		return memberMsgTimeCn;
	}

	public void setMemberMsgTimeCn(java.lang.String memberMsgTimeCn) {
		this.memberMsgTimeCn = memberMsgTimeCn;
	}

	public java.lang.String getCircleName() {
		return circleName;
	}

	public void setCircleName(java.lang.String circleName) {
		this.circleName = circleName;
	}
	
	/**
	 * 成员头像全URL
	 * example: http://192.168.1.xxx:8080/circle/1.png
	 * @return
	 */
	public java.lang.String getFullMemberImg() {
		if(StringUtil.isBlank(this.getMemberImg())){
			return "source://image/common/userLogin.png";
		}else if(this.getMemberImg().indexOf("source://")>-1){
			return this.getMemberImg();
		} else{
			return super.getImgHandleDomain()+""+this.getMemberImg()+""+UserConst.IMG_POSTFIX;
		}
	}
	
	public boolean isBlack() {
		if (YesNoEnum.YES.getCode()==this.getIsBlack()) {
			return true;
		}else{
			return false;
		}
	}

	public java.lang.String getGradeName() {
		return gradeName;
	}

	public void setGradeName(java.lang.String gradeName) {
		this.gradeName = gradeName;
	}

	public java.lang.Integer getSex() {
		return sex;
	}

	public void setSex(java.lang.Integer sex) {
		this.sex = sex;
	}
	
	public boolean isCircleCreator() {
		if (CircleMemberTypeDictEnum.OWNER.getCode()==this.getType()) {
			return true;
		}else{
			return false;
		}
	}
	
	public boolean isCircleManager() {
		if (CircleMemberTypeDictEnum.MANAGER.getCode()==this.getType()) {
			return true;
		}else{
			return false;
		}
	}
	
}